home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #6 / Amiga Plus CD - 1996 - No. 06.iso / pd / netz / internet-set.v4.0 / amitcp-4.0 / bin / hangup.rexx < prev    next >
OS/2 REXX Batch file  |  1996-07-22  |  3KB  |  73 lines

  1. /* Hangup.rexx                                                            */
  2. /*                                                                        */
  3. /* Version 1.0, 7 January 1993, by K. Raquel Sanborn (raquels@uhunix)     */
  4. /* Version 1.1, 1 March 1995, by Wes Tatters  (wtatters@world.net )       */
  5. /*                                                                        */
  6. /* Version 3.10  14th July 1996      by Kevin Anderson                    */
  7. /*                               (andersok@mail.bogo.co.uk)               */
  8. /*                                                                        */
  9. /* An ARexx script that will hangup the phone after killing AmiTCP        */
  10. /*                                                                        */
  11. /* ---------------------------------------------------------------------- */
  12.  
  13. /* Start the required libraries                      */
  14.  
  15.     say 'Opening libraries...'
  16.  
  17.     check = addlib('rexxsupport.library', 0, -30, 0)
  18.     if (check == 0) then say 'rexxsupport library did not open...'
  19.  
  20.     check = addlib('rexxserdev.library',  0, -30, 0)
  21.     if (check == 0) then say 'rexxserdev did not open...'
  22.  
  23.     cr        = '0d'x
  24.     hanup_str = 'ATH'||cr
  25.  
  26. /* Read user.dat file and get variables */
  27.  
  28. If Open(1,'AmiTCP:bin/user.dat','Read') Then         /* open file for Input */
  29.  
  30.     
  31.   BogoBit$ = ReadLn(1)          /* read file 1 into Bogobit$ variable */
  32.  
  33.   parse var BogoBit$ BogoName'*'BogoWord'*'BogoSpeed  /* split out variables */
  34.  
  35.     
  36. Close(1) 
  37.  
  38. /* Kill AmiTCP first */
  39.  
  40.     say 'KILLing AmiTCP via ARexx port...'
  41.     address AMITCP
  42.     'KILL'
  43.     result = delay(200)
  44.  
  45.  
  46. /* Open the serial device and talk to the modem                          */
  47.  
  48.  
  49.     say 'Setting up serial device...'
  50.     serhandle = SerOpen('serial.device', 0)
  51.     check     = SerClear(serhandle)
  52.     check     = SerSetParms(serhandle, BogoSpeed, 8, N, 1, 0 )
  53.  
  54. /* Send +++, wait the send ATH, then exit */
  55.  
  56.     say 'Sending +++'
  57.     check = SerWrite(serhandle, '+++', length('+++'))
  58.     check = delay(200)
  59.     say 'Sending ATH<cr>'
  60.     check = SerWrite(serhandle, 'A', 1)  /* Send it slow, I have a stupid */
  61.     check = delay(2)                     /* MODEM! */
  62.     check = SerWrite(serhandle, 'T', 1)
  63.     check = delay(2)
  64.     check = SerWrite(serhandle, 'H', 1)
  65.     check = delay(2)
  66.     check = SerWrite(serhandle, '0', 1)
  67.     check = delay(2)
  68.     check = SerWrite(serhandle, cr, 1)
  69.     check = delay(50)
  70.     check = SerClose(serhandle)
  71.     say 'Done.                    Now Click The Close Gadget'
  72. exit 0
  73.